package com.example.blog.service;

import com.example.blog.component.SecurityUtil;
import com.example.blog.mapper.UsersMapper;
import com.example.blog.model.UserInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Question UserService
 * @Date 2023/1/6 10:15
 * @Solution
 */
@Service
public class UserService {
    @Autowired
    UsersMapper usersMapper;
    public int add(String username,String password) {
        return usersMapper.add(username,password);
    }
    public UserInfo getByName(String username) {
        return usersMapper.getByName(username);
    }
    public UserInfo getById(int id) {
        return usersMapper.getById(id);
    }
    public int revisePs(String password,int id) {
        return usersMapper.revisePs(SecurityUtil.encrypt(password),id);
    }
    public int reviseUn(String username,int id) {
        return usersMapper.reviseUn(username,id);
    }
    public int reviseEm(String email,int id) {
        return usersMapper.reviseEm(email,id);
    }
    public int reviseProfile(String profile,int id) {
        return usersMapper.reviseProfile(profile,id);
    }
}
